<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>

    <!-- <link href="../static/bootstrap-3.3.7-dist/css/bootstrap.min.css" />
    <script src="../static/bootstrap-3.3.7-dist/js/jquery-2.1.1.js"></script>
    <script src="../static/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script> -->
    <link rel="stylesheet" href="../resource/layui/css/layui.css">
    <title>系统公告</title>
</head>

<body>
    <fieldset class="layui-elem-field layui-field-title" style="overflow: hidden;">
        <legend>系统公告</legend>
    </fieldset>    
        <div style="padding: 0 10px">
            <!-- 内容区域 -->
            <div style="width: 800px;margin: auto;">
                <form class="form-horizontal">
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">公告标题</label>
                        <div class="col-sm-10">
                            <input type="email" class="form-control" id="title" placeholder="请输入标题" autocomplete="off" required="required">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputPassword3" class="col-sm-2 control-label">发布时间</label>
                        <div class="col-sm-10">
                        	<input type="text" class="layui-input" id="createTime" autocomplete="off" required="required">
                        </div>
                    </div>
                    <div class="form-group">
                            <label for="inputPassword3" class="col-sm-2 control-label">公告内容</label>
                            <div class="col-sm-10">
                                <textarea style="width: 500px;height: 100px;" id="content" autocomplete="off" required="required"></textarea>
                            </div>
                        </div>
                    <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-10">
                            <button style="float: left" type="button" id="addnotice"
                                class="layui-btn layui-btn-sm">提交</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    
</body>
<script src="../resource/layui/layui.js"></script>
<script>
    //JavaScript代码区域
    layui.use(['element', 'table', 'form', 'jquery', 'layer','laydate'], function () {
        var element = layui.element,
            table = layui.table,
            form = layui.form,
            $ = layui.$,
            layer = layui.layer,
        	laydate = layui.laydate;

        laydate.render({
            elem: '#createTime' //指定元素
          });
        
        
        $("#addnotice").click(function(){
        	//alert($("#create_time").prop("value"));
        	var title = $("#title").prop("value");
        	var createTime = $("#createTime").prop("value");
        	var content = $("#content").prop("value");
        	$.ajax({
				url : "http://127.0.0.1/admin/addsysnotice.action",
				data : {"title":title,"createTime":createTime,"content":content},
				type : "get",
				success : function(result) {
					if(result=1){
						layer.msg('发布成功！', {icon: 1});
						$("#title").prop("value","");
						$("#createTime").prop("value","");
						$("#content").prop("value","");
					}else{
						layer.msg('操作失败！', {icon: 2});
					}
				}
			});
        });
        
    });
</script>

</html>